from django import template

register = template.Library ();


@register.filter
def mode (name):
    return str(name) or 'lotto';

@register.filter
def utility (list):
    return len(list) > 1;

@register.filter
def avg (list):
    return sum(list) / len(list);

@register.filter
def minimum (list):
    return min(list);

@register.filter
def maximum (list):
    return max(list);

@register.filter
def legend_ten (value):
    return str(1+10*(value-1))+'-'+str(value*10);

@register.filter
def has (list, item):
    if item in list:
        return True;
    else:
        return False;
